package club.babyf.common.exception;

import club.babyf.common.constants.BaseEnum;
import club.babyf.common.constants.ResultCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * BusinessException.
 *
 * @author zhanglei.
 * @date 2024/12/20 17:12.
 * @description BusinessException.
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class BusinessException extends RuntimeException {

    BaseEnum resultCode;

    public BusinessException(String msg) {
        super(msg);
        this.resultCode = ResultCode.Fail;
    }

    public BusinessException(BaseEnum resultCode) {
        super(resultCode.getName());
        this.resultCode = resultCode;
    }

    public BusinessException(BaseEnum resultCode, String msg) {
        super(msg);
        this.resultCode = resultCode;
    }

}
